<!-- //测试渲染时间svg是129ms -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="d3.v4.min.js"></script>
    <script>
        const width = 960
        height = 960
        num = 10000
        const nodes = d3.range(num).map(
            d=>{
                return {
                    x:Math.random()*width,
                    y:Math.random()*height
                }
            }
        )

        const t1 = new Date().getTime()

        const svg = d3.select("body")
        .append("svg")
        .attr("width",width)
        .attr('height',height)

        const node = svg.append('g')
        .selectAll('circle')
        .data(nodes)
        .enter()
        .append('circle')
        .attr('cx',d=>{return d.x})
        .attr("cy",d=>{return d.y})
        .attr('r',3)

        const t2 = new Date().getTime()

        console.log(`渲染时间是${t2-t1}ms`);
    </script>
</body>
</html>